/*
 * Copyright:  2018 smarabbit studio.
 *
 *  Licensed under the Confluent Community License; you may not use this file
 *  except in compliance with the License.  You may obtain a copy of the License at
 *
 *  http://www.confluent.io/confluent-community-license
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OF ANY KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations under the License.
 *
 *  @作   者： 黄开晖 (117227773@qq.com)
 *  @日   期:  2021年6月24日
 */
package com.massyframework.beanskin.graphql.util.pagelist;

import java.util.Collections;
import java.util.List;

/**
 * 分页记录
 * @author huangkh
 *
 */
public class PageList<T> {
	
	private int count;
	private int index;
	private List<T> items;

	/**
	 * 
	 */
	public PageList() {
		
	}

	/**
	 * 记录总数
	 * @return
	 */
	public int getCount() {
		return count;
	}

	/**
	 * 设置记录总数
	 * @param count
	 */
	public void setCount(int count) {
		this.count = count;
	}

	/**
	 * 获取当前页
	 * @return
	 */
	public int getIndex() {
		return index;
	}

	/**
	 * 设置当前页
	 * @param index
	 */
	public void setIndex(int index) {
		this.index = index;
	}
	
	/**
	 * 页内记录数量
	 * @return {@link int}
	 */
	public int getSize() {
		return this.items == null ? 0 : this.items.size();
	}

	/**
	 * 记录
	 * @return
	 */
	public List<T> getItems() {
		return items == null ?
				Collections.emptyList() : items;
	}

	/**
	 * 设置记录
	 * @param items
	 */
	public void setItems(List<T> items) {
		this.items = items;
	}
}
